interface TeamPageProps {
  params: { userId: string };
}

export default function TeamPage({ params: { userId } }: TeamPageProps) {
  return (
    <div className="space-y-6">
      {/* 页面标题 */}
      <div className="flex items-center justify-between">
        <div>
          <h1 className="text-3xl font-bold text-foreground">Team</h1>
          <p className="text-muted-foreground mt-1">团队成员管理和协作</p>
        </div>
        <button className="px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors">
          邀请成员
        </button>
      </div>

      {/* 团队统计 */}
      <div className="grid grid-cols-1 md:grid-cols-4 gap-6">
        <div className="bg-card rounded-xl p-6 border shadow-sm">
          <div className="flex items-center space-x-3">
            <div className="w-10 h-10 bg-blue-100 dark:bg-blue-900/20 rounded-lg flex items-center justify-center">
              <span className="text-blue-600 dark:text-blue-400 text-lg">👥</span>
            </div>
            <div>
              <div className="text-2xl font-bold text-foreground">8</div>
              <div className="text-sm text-muted-foreground">团队成员</div>
            </div>
          </div>
        </div>

        <div className="bg-card rounded-xl p-6 border shadow-sm">
          <div className="flex items-center space-x-3">
            <div className="w-10 h-10 bg-green-100 dark:bg-green-900/20 rounded-lg flex items-center justify-center">
              <span className="text-green-600 dark:text-green-400 text-lg">🟢</span>
            </div>
            <div>
              <div className="text-2xl font-bold text-foreground">6</div>
              <div className="text-sm text-muted-foreground">在线成员</div>
            </div>
          </div>
        </div>

        <div className="bg-card rounded-xl p-6 border shadow-sm">
          <div className="flex items-center space-x-3">
            <div className="w-10 h-10 bg-purple-100 dark:bg-purple-900/20 rounded-lg flex items-center justify-center">
              <span className="text-purple-600 dark:text-purple-400 text-lg">💼</span>
            </div>
            <div>
              <div className="text-2xl font-bold text-foreground">3</div>
              <div className="text-sm text-muted-foreground">项目经理</div>
            </div>
          </div>
        </div>

        <div className="bg-card rounded-xl p-6 border shadow-sm">
          <div className="flex items-center space-x-3">
            <div className="w-10 h-10 bg-orange-100 dark:bg-orange-900/20 rounded-lg flex items-center justify-center">
              <span className="text-orange-600 dark:text-orange-400 text-lg">🎯</span>
            </div>
            <div>
              <div className="text-2xl font-bold text-foreground">15</div>
              <div className="text-sm text-muted-foreground">活跃任务</div>
            </div>
          </div>
        </div>
      </div>

      {/* 团队成员列表 */}
      <div className="bg-card rounded-xl border shadow-sm">
        <div className="p-6 border-b border-border">
          <div className="flex items-center justify-between">
            <h2 className="text-xl font-semibold text-foreground">团队成员</h2>
            <div className="flex items-center space-x-2">
              <input 
                type="text" 
                placeholder="搜索成员..." 
                className="px-3 py-1 border border-input rounded-md text-sm bg-background"
              />
              <select className="px-3 py-1 border border-input rounded-md text-sm bg-background">
                <option>全部角色</option>
                <option>项目经理</option>
                <option>开发者</option>
                <option>设计师</option>
                <option>测试员</option>
              </select>
            </div>
          </div>
        </div>
        
        <div className="p-6">
          <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
            {/* 团队成员卡片 */}
            {[
              {
                name: '张小明',
                role: '项目经理',
                email: 'zhangxm@company.com',
                status: 'online',
                avatar: 'Z',
                tasksCount: 8,
                joinDate: '2023-06-15',
                skills: ['项目管理', '团队协作', 'Agile']
              },
              {
                name: '李小红',
                role: '前端开发',
                email: 'lixh@company.com',
                status: 'online',
                avatar: 'L',
                tasksCount: 12,
                joinDate: '2023-08-20',
                skills: ['React', 'TypeScript', 'UI/UX']
              },
              {
                name: '王小刚',
                role: '后端开发',
                email: 'wangxg@company.com',
                status: 'offline',
                avatar: 'W',
                tasksCount: 10,
                joinDate: '2023-07-10',
                skills: ['Node.js', 'Python', '数据库']
              },
              {
                name: '赵小美',
                role: 'UI/UX设计师',
                email: 'zhaoxm@company.com',
                status: 'online',
                avatar: 'Z',
                tasksCount: 6,
                joinDate: '2023-09-05',
                skills: ['Figma', 'Photoshop', '用户研究']
              },
              {
                name: '刘小华',
                role: '测试工程师',
                email: 'liuxh@company.com',
                status: 'busy',
                avatar: 'L',
                tasksCount: 9,
                joinDate: '2023-05-30',
                skills: ['自动化测试', 'Bug追踪', 'QA']
              },
              {
                name: '陈小波',
                role: '产品经理',
                email: 'chenxb@company.com',
                status: 'online',
                avatar: 'C',
                tasksCount: 7,
                joinDate: '2023-04-12',
                skills: ['产品规划', '需求分析', '市场调研']
              }
            ].map((member, index) => (
              <div key={index} className="border border-border rounded-lg p-4 hover:bg-muted/50 transition-colors">
                <div className="flex items-start space-x-3">
                  <div className="relative">
                    <div className="w-12 h-12 bg-primary rounded-full flex items-center justify-center text-primary-foreground font-semibold">
                      {member.avatar}
                    </div>
                    <div className={`absolute -bottom-1 -right-1 w-4 h-4 rounded-full border-2 border-white dark:border-slate-800 ${
                      member.status === 'online' ? 'bg-green-500' :
                      member.status === 'busy' ? 'bg-yellow-500' : 'bg-gray-400'
                    }`}></div>
                  </div>
                  
                  <div className="flex-1 min-w-0">
                    <h3 className="font-medium text-foreground truncate">{member.name}</h3>
                    <p className="text-sm text-muted-foreground">{member.role}</p>
                    <p className="text-xs text-muted-foreground truncate">{member.email}</p>
                    
                    <div className="mt-3">
                      <div className="flex items-center justify-between text-sm mb-2">
                        <span className="text-muted-foreground">任务数量</span>
                        <span className="font-medium text-foreground">{member.tasksCount}</span>
                      </div>
                      
                      <div className="flex items-center justify-between text-sm mb-3">
                        <span className="text-muted-foreground">加入时间</span>
                        <span className="text-foreground">{member.joinDate}</span>
                      </div>
                      
                      <div className="flex flex-wrap gap-1">
                        {member.skills.slice(0, 2).map((skill, skillIndex) => (
                          <span 
                            key={skillIndex} 
                            className="px-2 py-1 text-xs bg-muted text-muted-foreground rounded-full"
                          >
                            {skill}
                          </span>
                        ))}
                        {member.skills.length > 2 && (
                          <span className="px-2 py-1 text-xs bg-muted text-muted-foreground rounded-full">
                            +{member.skills.length - 2}
                          </span>
                        )}
                      </div>
                    </div>
                    
                    <div className="flex items-center space-x-2 mt-4">
                      <button className="flex-1 px-3 py-1 text-sm bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors">
                        查看详情
                      </button>
                      <button className="px-3 py-1 text-sm border border-input rounded-md hover:bg-accent transition-colors">
                        发消息
                      </button>
                    </div>
                  </div>
                </div>
              </div>
            ))}
          </div>
        </div>
      </div>

      {/* 最近活动 */}
      <div className="bg-card rounded-xl border shadow-sm">
        <div className="p-6 border-b border-border">
          <h2 className="text-xl font-semibold text-foreground">团队最近活动</h2>
        </div>
        <div className="p-6">
          <div className="space-y-4">
            {[
              {
                user: '张小明',
                action: '创建了新任务',
                target: '"用户界面优化"',
                time: '2小时前',
                avatar: 'Z'
              },
              {
                user: '李小红',
                action: '完成了任务',
                target: '"登录页面重构"',
                time: '4小时前',
                avatar: 'L'
              },
              {
                user: '王小刚',
                action: '更新了项目',
                target: '"API文档"',
                time: '6小时前',
                avatar: 'W'
              },
              {
                user: '赵小美',
                action: '上传了设计稿',
                target: '"移动端界面设计"',
                time: '1天前',
                avatar: 'Z'
              }
            ].map((activity, index) => (
              <div key={index} className="flex items-center space-x-3 p-3 bg-muted/50 rounded-lg">
                <div className="w-8 h-8 bg-primary rounded-full flex items-center justify-center text-primary-foreground text-sm font-medium">
                  {activity.avatar}
                </div>
                <div className="flex-1">
                  <p className="text-sm text-foreground">
                    <span className="font-medium">{activity.user}</span>
                    {' '}{activity.action}{' '}
                    <span className="font-medium">{activity.target}</span>
                  </p>
                  <p className="text-xs text-muted-foreground">{activity.time}</p>
                </div>
              </div>
            ))}
          </div>
        </div>
      </div>
    </div>
  );
} 